﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using eventr.View.Util;

namespace eventr.View
{
    public partial class FlyThroughUrlPopup : UserControl
    {
        static readonly DependencyProperty UrlProperty;

        bool visible = false;

        public event EventHandler PlayFlyThrough;
        public event EventHandler HideFlyThrough;

        public FlyThroughUrlPopup()
        {
            InitializeComponent();            
        }

        public void Show()
        {
            visible = true;
            updateStates(true);
        }

        public void Hide()
        {
            visible = false;
            updateStates(true);
        }

        void updateStates(bool trans)
        {
            if (visible)
            {
                VisualStateManager.GoToState(this, "Visible", trans);
            }
            else
            {
                VisualStateManager.GoToState(this, "Invisible", trans);
            }
        }

        private void Close_Click(object sender, RoutedEventArgs e)
        {
            Hide();
            if (HideFlyThrough != null)
            {
                HideFlyThrough(this, EventArgs.Empty);
            }
        }

        private void txtUrl_GotFocus(object sender, RoutedEventArgs e)
        {
            txtUrl.SelectAll();
            Clipboard.SetText(txtUrl.Text);
        }

        private void txtThisURLOnly_GotFocus(object sender, RoutedEventArgs e)
        {
            txtThisURLOnly.SelectAll();
            Clipboard.SetText(txtUrl.Text);
        }     
    }
}
